﻿using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.StandardApprovalFlow.Dto;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.StandardApprovalFlow
{
    /// <summary>
    /// 供应商新品核价流程 接口
    /// </summary>
    // [Authorize]
    [ApiController]
    [Route("api/jcpdtcphjlc")]
    public class JCPDTCPHJLCController : BPMReportPlatformController
    {
        private readonly IJCPDTCPHJLCService _jCPDTCPHJLCService;

        public JCPDTCPHJLCController(IJCPDTCPHJLCService jCPDTCPHJLCService)
        {
            _jCPDTCPHJLCService = jCPDTCPHJLCService;
        }

        /// <summary>
        ///召回流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("GetAllAsync")]
        public async Task<PagedResultDto<GetJCPDTCPHJLCOutput>> GetAllAsync([FromBody] GetJCPDTCPHJLCInput input)
        {
            return await _jCPDTCPHJLCService.GetAllAsync(input);
        }

        /// <summary>
        /// 召回流程  导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("ExportAsync")]
        public async Task<XlsxFileResult<GetJCPDTCPHJLCOutput>> ExportAsync([FromBody] GetJCPDTCPHJLCInput input)
        {
            var rst = await _jCPDTCPHJLCService.ExportAsync(input);
            return new XlsxFileResult<GetJCPDTCPHJLCOutput>(rst, "导出Excel");
        }
    }
}